package com.Smart.smartscals.Adapter;

import java.util.ArrayList;

import com.Smart.smartscals.Activity.R;
import com.Smart.smartscals.Activity.SmartScalsApplication;
import com.Smart.smartscals.CustomView.CustomWeightView;
import com.Smart.smartscals.Utils.Tools;


import android.content.Context;
import android.graphics.Color;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.LayoutParams;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class CustomWeightPagerAdapter extends PagerAdapter {
	private ArrayList<String> arrayListStr;
	private Context mContext;
	private CustomWeightView mCustomWeightView;

	public CustomWeightPagerAdapter(ArrayList<String> arrayListStr,
			Context mContext, CustomWeightView mCustomWeightView) {
		super();
		this.arrayListStr = arrayListStr;
		this.mContext = mContext;
		this.mCustomWeightView = mCustomWeightView;
	}

	@Override
	public int getCount() {
		return arrayListStr.size();
	}

	@Override
	public boolean isViewFromObject(View view, Object object) {
		return (view == object);
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {

		View v = LayoutInflater.from(mContext).inflate(
				R.layout.custom_weightchoice_tv, null);
		TextView tv = (TextView) v.findViewById(R.id.textView1);
		tv.setText(arrayListStr.get(position));
		tv.setTextColor(Color.WHITE);
		tv.setTextSize(50);

		container.addView(v);
		return v;

	}

	@Override
	public float getPageWidth(int position) {
		return (float) 0.33333;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView((View) object);
	}
}
